using System;
using System.ComponentModel;
using System.Threading;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Threading;
using JMClient.ViewModels;
using System.Reactive.Linq; 
namespace JMClient.Views;

public partial class MainWindow : Avalonia.Controls.Window
{

    public MainWindow() 
    {
        InitializeComponent();
  
      

        // 在窗口显示之前应用配置
        this.Loaded += (_, __) =>
        {
            (DataContext as MainWindowViewModel)?.ApplyWindowSettings(this);
        };
        
        // 在窗口关闭前保存状态
        this.Closing += (_, __) =>
        {
            (DataContext as MainWindowViewModel)?.SaveOnExit(this);
        };
    }
    

}
